<template>
  <div id="projectMessage">
    <div class="messageSwdy">基本信息</div>
    <div class="baseBox">
      <div class="baseLeft">
        <p>
          <span>发行方式：</span>
          <span>{{data.pubMethod}}</span>
        </p>
        <p>
          <span>项目编号：</span>
          <span>{{data.sNo}}</span>
        </p>
        <p>
          <span>项目名称：</span>
          <span>{{data.projectName}}</span>
        </p>
        <p>
          <span>项目概述：</span>
          <span>{{data.proDesc}}</span>
        </p>
        <!-- <p>
          <span>状&emsp;&emsp;态：</span>
          <span>{{data.state | filterzt}}</span>
        </p> -->
        <p>
          <span>交易模式：</span>
          <span>{{data.tradePattern}}</span>
          <!-- <span>供应商</span> -->
        </p>
        <p>
          <span>创&nbsp;建&nbsp;&nbsp;者：</span>
          <span>{{data.creator}}</span>
        </p>
        <p>
          <span>项目邮箱：</span>
          <span>{{data.mailBox}}</span>
        </p>
      </div>
      <div class="baseRight">
        <img src="../../assets/images/danbao.png" />
        <el-button type="primary" size="small" @click="dialogVisible=true">查看</el-button>
      </div>
    </div>
    <!-- --------------------------- -->
    <div class="messageSwdy">
      项目组成员
      <span class="bianji" @click="xmClick">{{xmbj? '编辑': '完成'}}</span>
      <span class="back" @click="back('xmbj')" v-if="!xmbj">返回</span>
    </div>
    <div class="tableBox">
      <table class="leave">
        <tr>
          <td>负责人</td>
          <td v-if="xmbj">{{data.principal}}</td>
          <td v-else>
            <el-input size="small" v-model="data.principal"></el-input>
          </td>
        </tr>
        <tr>
          <td>项目成员</td>
          <td v-if="xmbj">{{data.teamMember}}</td>
          <td v-else>
            <el-input size="small" v-model="data.teamMember"></el-input>
          </td>
        </tr>
      </table>
    </div>
    <!-- --------------------------- -->
    <div class="messageSwdy" v-if="data.pubMethod == '储架式'">
      储架信息
      <span class="bianji" @click="cjClick">{{cjbj?'编辑': '完成'}}</span>
      <span class="back" @click="back('cjbj')" v-if="!cjbj">返回</span>
    </div>
    <div class="tableBox" v-if="data.pubMethod == '储架式'">
      <table class="leave" style="margin-bottom: 10px;">
        <tr>
          <td>储架编号</td>
          <td v-if="cjbj">{{chujiaData.frameNo}}</td>
          <td v-else>
            <el-input size="small" v-model="chujiaData.frameNo"></el-input>
          </td>
          <td>储架名称</td>
          <td v-if="cjbj">{{chujiaData.frameName}}</td>
          <td v-else>
            <el-input size="small" v-model="chujiaData.frameName"></el-input>
          </td>
        </tr>
        <tr>
          <td>拟发行规模(亿)</td>
          <td v-if="cjbj">{{chujiaData.issueSize}}</td>
          <td v-else>
            <el-input size="small" v-model="chujiaData.issueSize"></el-input>
          </td>
          <td>发行次数(次)</td>
          <td v-if="cjbj">{{chujiaData.issueTimes}}</td>
          <td v-else>
            <el-input size="small" v-model="chujiaData.issueTimes"></el-input>
          </td>
        </tr>
        <tr>
          <td>设立日期</td>
          <td v-if="cjbj">{{chujiaData.startDate | dateformat}}</td>
          <td v-else>
            <el-date-picker
              v-model="chujiaData.startDate"
              type="date"
              size="small"
              placeholder="选择日期"
            ></el-date-picker>
          </td>
          <td>拟结束日期</td>
          <td v-if="cjbj">{{chujiaData.endDate | dateformat}}</td>
          <td v-else>
            <el-date-picker
              v-model="chujiaData.endDate"
              type="date"
              size="small"
              placeholder="选择日期"
            ></el-date-picker>
          </td>
        </tr>
      </table>
    </div>
    <!-- --------------------------- -->
    <div class="messageSwdy">
      保理业务信息
      <span class="bianji" @click="blClick">{{blbj?'编辑': '完成'}}</span>
      <span class="back" @click="back('blbj')" v-if="!blbj">返回</span>
    </div>
    <div class="tableBox">
      <table class="leave">
        <tr>
          <td>保理公司</td>
          <td v-if="blbj">{{baoliData.companyName}}</td>
          <!-- <td v-else><el-input size="small" v-model="baoliData.companyName"></el-input></td> -->
          <td v-else>
            <el-input
              size="small"
              v-model="baoliData.companyName"
              disabled
              style="width: calc(100% - 64px); display: inline-block;"
            ></el-input>
            <el-button type="primary" size="mini" @click="choose('baoli')">选择</el-button>
          </td>

          <td>保理公司联系人</td>
          <td v-if="blbj">{{baoliData.contact}}</td>
          <td v-else>
            <el-input size="small" v-model="baoliData.contact"></el-input>
          </td>
        </tr>
        <tr>
          <td>银行账号</td>
          <td v-if="blbj">{{baoliData.bankAccount}}</td>
          <td v-else>
            <el-input size="small" v-model="baoliData.bankAccount"></el-input>
          </td>
          <td>融资比例(%)</td>
          <td v-if="blbj">{{baoliData.financingRate}}</td>
          <td v-else>
            <el-input size="small" v-model="baoliData.financingRate"></el-input>
          </td>
        </tr>
        <tr>
          <td>服务费(元/人民币)</td>
          <td v-if="blbj">{{baoliData.serviceFee}}</td>
          <td v-else>
            <el-input size="small" v-model="baoliData.serviceFee"></el-input>
          </td>
          <td>项目期限(天)</td>
          <td v-if="blbj">{{baoliData.limitDate}}</td>
          <td v-else>
            <el-input size="small" v-model="baoliData.limitDate"></el-input>
          </td>
        </tr>
        <tr>
          <td>计算基数</td>
          <td v-if="blbj">{{baoliData.base}}</td>
          <td v-else>
            <el-input size="small" v-model="baoliData.base"></el-input>
          </td>
          <td>投放金额计算公式</td>
          <td v-if="blbj">{{baoliData.calculationFormula}}</td>
          <td v-else>
            <el-input size="small" v-model="baoliData.calculationFormula"></el-input>
          </td>
        </tr>
      </table>
    </div>
    <div class="messageSwdy">核心企业</div>
    <div class="tableBox">
      <table class="vertatic">
        <tr>
          <td>公司名称</td>
          <td>联系人名称</td>
          <td>操作</td>
        </tr>
        <tr>
          <td v-if="hashxqy">{{hxqy.companyName}}</td>
          <!-- <td v-else><el-input size="small" v-model="hxqy.companyName"></el-input></td> -->
          <td v-else>
            <el-input
              size="small"
              v-model="hxqy.companyName"
              disabled
              style="width: calc(100% - 64px); display: inline-block;"
            ></el-input>
            <el-button type="primary" size="mini" @click="choose('hexin')">选择</el-button>
          </td>
          <td v-if="hashxqy">{{hxqy.contact}}</td>
          <td v-else>
            <el-input size="small" v-model="hxqy.contact"></el-input>
          </td>
          <td>
            <span style="color: #409EFF;" @click="back('hashxqy')" v-if="!hashxqy">返回</span>
            <span class="red" @click="bjhx(hxqy)">{{hashxqy? '编辑':'完成'}}</span>
          </td>
        </tr>
      </table>
    </div>
    <!-- ---------------------------------- -->
    <div class="messageSwdy">律师事务所</div>
    <div class="tableBox">
      <table class="vertatic">
        <tr>
          <td>公司名称</td>
          <td>联系人名称</td>
          <td>操作</td>
        </tr>
        <tr>
          <td v-if="haslssws">{{lssws.companyName}}</td>
          <!-- <td v-else><el-input size="small" v-model="lssws.companyName"></el-input></td> -->
          <td v-else>
            <el-input
              size="small"
              v-model="lssws.companyName"
              disabled
              style="width: calc(100% - 64px); display: inline-block;"
            ></el-input>
            <el-button type="primary" size="mini" @click="choose('lssws')">选择</el-button>
          </td>
          <td v-if="haslssws">{{lssws.contact}}</td>
          <td v-else>
            <el-input size="small" v-model="lssws.contact"></el-input>
          </td>
          <td>
            <span style="color: #409EFF;" @click="back('haslssws')" v-if="!haslssws">返回</span>
            <span class="red" @click="bjlssws">{{haslssws? '编辑':'完成'}}</span>
          </td>
        </tr>
      </table>
    </div>
    <!-- ---------------------------------- -->
    <div class="messageSwdy">担保方</div>
    <div class="tableBox">
      <table class="vertatic">
        <tr>
          <td>公司名称</td>
          <td>联系人名称</td>
          <td>操作</td>
        </tr>
        <tr>
          <td v-if="hasdbf">{{dbf.companyName}}</td>
          <!-- <td v-else><el-input size="small" v-model="dbf.companyName"></el-input></td> -->
          <td v-else>
            <el-input
              size="small"
              v-model="dbf.companyName"
              disabled
              style="width: calc(100% - 64px); display: inline-block;"
            ></el-input>
            <el-button type="primary" size="mini" @click="choose('dbfang')">选择</el-button>
          </td>
          <td>{{dbf.contact}}</td>
          <!-- <td v-else>
            <el-input size="small" v-model="dbf.contact"></el-input>
          </td> -->
          <td>
            <span style="color: #409EFF;" @click="back('hasdbf')" v-if="!hasdbf">返回</span>
            <span class="red" @click="bjdbf">{{hasdbf? '编辑':'完成'}}</span>
          </td>
        </tr>
      </table>
    </div>
    <!-- ---------------------------------- -->
    <div class="messageSwdy">差额支付承诺人</div>
    <div class="tableBox">
      <table class="vertatic">
        <tr>
          <td>公司名称</td>
          <td>联系人名称</td>
          <td>操作</td>
        </tr>
        <tr>
          <td v-if="hascezfcnr">{{cezfcnr.companyName}}</td>
          <!-- <td v-else><el-input size="small" v-model="cezfcnr.companyName"></el-input></td> -->
          <td v-else>
            <el-input
              size="small"
              v-model="cezfcnr.companyName"
              disabled
              style="width: calc(100% - 64px); display: inline-block;"
            ></el-input>
            <el-button type="primary" size="mini" @click="choose('cezf')">选择</el-button>
          </td>
          <td v-if="hascezfcnr">{{cezfcnr.contact}}</td>
          <td v-else>
            <el-input size="small" v-model="cezfcnr.contact"></el-input>
          </td>
          <td>
            <span style="color: #409EFF;" @click="back('hascezfcnr')" v-if="!hascezfcnr">返回</span>
            <span class="red" @click="bjcezfcnr">{{hascezfcnr? '编辑':'完成'}}</span>
          </td>
        </tr>
      </table>
    </div>
    <!-- ---------------------------------- -->
    <div class="messageSwdy">共同债务人</div>
    <div class="tableBox">
      <table class="vertatic">
        <tr>
          <td>公司名称</td>
          <td>联系人名称</td>
          <td>操作</td>
        </tr>
        <tr>
          <td v-if="hasgtzwr">{{gtzwr.companyName}}</td>
          <!-- <td v-else><el-input size="small" v-model="gtzwr.companyName"></el-input></td> -->
          <td v-else>
            <el-input
              size="small"
              v-model="gtzwr.companyName"
              disabled
              style="width: calc(100% - 64px); display: inline-block;"
            ></el-input>
            <el-button type="primary" size="mini" @click="choose('gtzw')">选择</el-button>
          </td>
          <td v-if="hasgtzwr">{{gtzwr.contact}}</td>
          <td v-else>
            <el-input size="small" v-model="gtzwr.contact"></el-input>
          </td>
          <td>
            <span style="color: #409EFF;" @click="back('hasgtzwr')" v-if="!hasgtzwr">返回</span>
            <span class="red" @click="bjgtzwr">{{hasgtzwr? '编辑':'完成'}}</span>
          </td>
        </tr>
      </table>
    </div>
    <!-- ---------------------------------- -->
    <div class="messageSwdy">债务加入方</div>
    <div class="tableBox">
      <table class="vertatic">
        <tr>
          <td>公司名称</td>
          <td>联系人名称</td>
          <td>操作</td>
        </tr>
        <tr>
          <td v-if="haszwjrf">{{zwjrf.companyName}}</td>
          <!-- <td v-else><el-input size="small" v-model="zwjrf.companyName"></el-input></td> -->
          <td v-else>
            <el-input
              size="small"
              v-model="zwjrf.companyName"
              disabled
              style="width: calc(100% - 64px); display: inline-block;"
            ></el-input>
            <el-button type="primary" size="mini" @click="choose('zwjrf')">选择</el-button>
          </td>
          <td v-if="haszwjrf">{{zwjrf.contact}}</td>
          <td v-else>
            <el-input size="small" v-model="zwjrf.contact"></el-input>
          </td>
          <td>
            <span style="color: #409EFF;" @click="back('haszwjrf')" v-if="!haszwjrf">返回</span>
            <span class="red" @click="bjzwjrf">{{haszwjrf? '编辑':'完成'}}</span>
          </td>
        </tr>
      </table>
    </div>
    <el-dialog title="查看已选择公司" :visible.sync="dialogVisible" width="900px" center :before-close="handleClose">
      <div class="eldtitle"><span>担保方：</span>
        <el-tag type="info" v-for="(item, index) in daf" :key="index" >{{item.name}}</el-tag>
        <el-tag type="info" v-if="daf.length == 0"  >无</el-tag>
      </div>
      <div class="eldtitle"><span>项目公司：</span> 
        <el-tag type="warning" v-for="(item, index) in xmgs" :key="index" >{{item.name}}</el-tag>
        <el-tag type="warning" v-if="xmgs.length == 0">无</el-tag>
      </div>
      <div class="eldtitle"><span>供应商：</span>
       <el-tag type="danger" v-for="(item, index) in gys" :key="index" >{{item.name}}</el-tag>
       <el-tag type="danger" v-if="gys.length == 0" >无</el-tag>
      </div>
    </el-dialog>
    <!-- ---------------------------DIALOG------------------------------------ -->
    <!-- <el-dialog title="项目组成员" :visible.sync="dialogXiangmu" width="708px" center>
      <div style="margin-bottom: 16px;">
        <span>负责人：</span>
        <el-select v-model="dialogxm.value" placeholder="请选择" size="small">
          <el-option
            v-for="item in dialogxm.diaxmOption"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </div>
      <el-row>
        <el-col :span="4">项目组成员：</el-col>
        <el-col :span="20">
          <el-checkbox-group v-model="dialogxm.chengyuan">
            <el-checkbox label="复选框 A"></el-checkbox>
            <el-checkbox label="复选框 B"></el-checkbox>
            <el-checkbox label="复选框 C"></el-checkbox>
          </el-checkbox-group>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogXiangmu = false">提交</el-button>
      </span>
    </el-dialog>-->
    <!-- -----------------------储架信息新增------------------------------- -->
    <!-- <el-dialog title="储架信息" :visible.sync="dialogchujia" width="708px" center :before-close="handleClose">
      <el-row class="swelrow">
        <el-col :span="5" class="left">储架编号：</el-col>
        <el-col :span="16">
          <el-input size="small"  v-model="newchujia.frameNo"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">储架名称：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newchujia.frameName"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">拟发行规模(亿)：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newchujia.issueSize"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">发行次数：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newchujia.issueTimes" type="number"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">设计日期：</el-col>
        <el-col :span="16">
          <el-date-picker v-model="newchujia.startDate" type="date" placeholder="选择日期" size="small" value-format="yyyy-MM-dd"></el-date-picker>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">拟结束日期：</el-col>
        <el-col :span="16">
          <el-date-picker v-model="newchujia.endDate" type="date" placeholder="选择日期" size="small" value-format="yyyy-MM-dd"></el-date-picker>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="subNewchujia">提交</el-button>
      </span>
    </el-dialog>-->
    <!-- -----------------------储架信息编辑------------------------------- -->
    <!-- <el-dialog title="储架信息" :visible.sync="dialogBJchujia" width="708px" center  :before-close="handleClose">
      <el-row class="swelrow">
        <el-col :span="5" class="left">储架编号：</el-col>
        <el-col :span="16">
          <el-input size="small"  v-model="SavingFrameWorkInfoList[0].frameNo"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">储架名称：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="SavingFrameWorkInfoList[0].frameName"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">拟发行规模(亿)：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="SavingFrameWorkInfoList[0].issueSize"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">发行次数：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="SavingFrameWorkInfoList[0].issueTimes" type="number"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">设计日期：</el-col>
        <el-col :span="16">
          <el-date-picker v-model="SavingFrameWorkInfoList[0].startDate" type="date" placeholder="选择日期" size="small"></el-date-picker>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">拟结束日期：</el-col>
        <el-col :span="16">
          <el-date-picker v-model="SavingFrameWorkInfoList[0].endDate" type="date" placeholder="选择日期" size="small"></el-date-picker>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitbjChujia(SavingFrameWorkInfoList[0].frameId)">提交</el-button>
      </span>
    </el-dialog>-->
    <!-- --------------------------------------------------- -->
    <!-- <el-dialog title="保理业务信息" :visible.sync="dialogbaoli" width="708px" center>
      <el-row class="swelrow">
        <el-col :span="5" class="left">保理公司：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newbaoli.companyName"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">保理公司联系人：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newbaoli.contact"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">银行账号：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newbaoli.bankAccount"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">融资比例(%)：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newbaoli.financingRate"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">服务费(元/人民币)：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newbaoli.serviceFee"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">项目期限(天)：</el-col>
        <el-col :span="16">
          <el-input size="small" v-model="newbaoli.limitDate" type="number"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">计算基数：</el-col>
        <el-col :span="16">
          <el-input size="small"  v-model="newbaoli.base"></el-input>
        </el-col>
      </el-row>
      <el-row class="swelrow">
        <el-col :span="5" class="left">投放金额计算公式：</el-col>
        <el-col :span="16">
          <el-input size="small"  v-model="newbaoli.calculationFormula"></el-input>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="newdialogbaoli">提交</el-button>
      </span>
    </el-dialog>-->
    <!-- ----------------------------------- -->
    <!-- <el-dialog :visible.sync="dialogTable" width="900px">
      <div class="swdyTops">
        <span class="search">搜索公司：</span>
        <el-input class="elinput" size="small" placeholder="请输入公司关键字"></el-input>
        <span class="sousuo">搜索不到？</span>
        <el-button class="gocreat" size="small" type="primary">去创建</el-button>
      </div>
      <div class="diatable">
        <el-table :data="diatableData" border style="width: 100%">
          <el-table-column prop="date" label="序号" width="180" align="center"></el-table-column>
          <el-table-column prop="name" label="客户名称" width="180" align="center"></el-table-column>
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-button type="primary" size="mini" @click="look">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="block">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            layout="total, prev, pager, next, jumper"
            :total="400"
          ></el-pagination>
        </div>
      </div>
    </el-dialog>-->
  </div>
</template>

<script>
export default {
  name: "projectMessage",
  data() {
    return {
      active: 3,
      xmbj: true,
      cjbj: true,
      blbj: true,
      hxbj: true,
      // dialogXiangmu: false,
      // dialogchujia: false,
      // dialogbaoli: false,
      // dialoghexin: false,
      // dialoglvshi: false, //律师
      // dialoglvshi: false, //担保方
      // dialogmeia: false,
      // dialoggongtong: false,
      // dialogzhaiwu: false,
      // dialogTable: false,
      // diatableData: false,
      // dialogBJchujia: false, //编辑储架信息
      // test: '1554163200000',
      // dialogxm: {
      //   diaxmOption: [
      //   ],
      //   value: "",
      //   chengyuan: []
      // },
      // dialogchujiaCon: {
      //   shejidata: "",
      //   enddata: ""
      // },
      chujiaData: {
        projectId: sessionStorage.getItem("swdypId"), // 关联项目Id
        frameNo: "", // 储架编号
        frameName: "", // 储架名称
        issueSize: "", // 拟发行规模
        issueTimes: "", // 发行次数
        startDate: "", // 设立日期
        endDate: "", // 拟结束日期
        frameId: "" //储架信息id
      },
      hasChujia: false,
      currentPage: 1,
      baoliData: {
        projectId: sessionStorage.getItem("swdypId"),
        factorId: "", //String 保理业务信息id
        bankAccount: "", //String 银行账号
        serviceFee: "", //String 服务费
        companyName: "", //String 保理公司
        contact: "", //String 保理公司联系人
        limitDate: "", //String 项目期限
        calculationFormula: "", //String 投放金额计算公式
        financingRate: "", //String 融资比例
        base: "" //String 计算基数
      },
      hasbaoli: false,
      // --------------------------------------------
      data: "", //获取
      SavingFrameWorkInfoList: "", //储架信息
      FactoringInfoList: "", //保理业务信息
      hxqy: {
        projectId: sessionStorage.getItem("swdypId"),
        companyName: "",
        contact: "",
        type: "核心企业"
      },
      hashxqy: true,
      lssws: {
        projectId: sessionStorage.getItem("swdypId"),
        companyName: "",
        contact: "",
        type: "律师事务所"
      },
      haslssws: true,
      dbf: {
        projectId: sessionStorage.getItem("swdypId"),
        companyName: "",
        clientId: '',
        contact: "",
        type: "担保方"
      },
      hasdbf: true,
      cezfcnr: {
        projectId: sessionStorage.getItem("swdypId"),
        companyName: "",
        contact: "",
        type: "差额支付承诺人"
      },
      hascezfcnr: true,
      gtzwr: {
        projectId: sessionStorage.getItem("swdypId"),
        companyName: "",
        contact: "",
        type: "共同债务人"
      },
      hasgtzwr: true,
      zwjrf: {
        projectId: sessionStorage.getItem("swdypId"),
        companyName: "",
        contact: "",
        type: "债务加入方"
      },
      haszwjrf: true,
      // newbaoli: {
      //   projectId: sessionStorage.getItem('swdypId'),// string 关联项目ID
      //   companyName: '',// string 保理公司
      //   contact: '',// string 保理公司联系人
      //   bankAccount: '',// string 银行账号
      //   financingRate: '',// string 融资比例
      //   serviceFee: '',// string 服务费
      //   limitDate: '',// Date 项目期限
      //   base: '',// string 计算基数
      //   calculationFormula: '',// string 投放金额计算公式
      // }
      pId: "",
      currentCom: "",
      dialogVisible: false,
      daf: [],
      gys: [],
      xmgs: []
    };
  },
  created() {},
  mounted() {
    this.pId = sessionStorage.getItem("swdypId");
    // 获取供应商信息
    this.getgys();
    this.getdata();
  },
  methods: {
    getgys() {
      this.axios.get('AdminAPI/project/showProjectBaseInfo',{params:{id: sessionStorage.getItem("swdypId")}})
        .then(({data})=> {
          if(data.code == 200) {
            let proarr = data.data.ProjectClientInfoList;
            let daf= proarr.filter((item, index)=> {
              return item.companyRole == '担保方'
            })
            let xmgs= proarr.filter((item, index)=> {
              return item.companyRole == '项目公司'
            })
            let gys = proarr.filter((item, index)=> {
              return item.companyRole == '供应商'
            })
            this.daf = daf;
            this.xmgs = xmgs;
            this.gys = gys;
          }
        })
    },
    back(item) {
      this.$data[item] = true;
      this.getdata();
    },
    choose(pam) {
      this.$bus.$emit("chooseCompany", {
        callback: (data,clientId) => {
          if (pam == "baoli") {
            this.baoliData.companyName = data;
          } else if (pam == "hexin") {
            this.hxqy.companyName = data;
          } else if (pam == "lssws") {
            this.lssws.companyName = data;
          } else if (pam == "dbfang") {
            this.$set(this.dbf, 'companyName', data)
            // this.dbf.companyName = data;
            this.dbf.clientId = clientId;
          } else if (pam == "cezf") {
            this.cezfcnr.companyName = data;
          } else if (pam == "gtzw") {
            this.gtzwr.companyName = data;
          } else if (pam == "zwjrf") {
            this.zwjrf.companyName = data;
          }
        }
      });
    },
    bjzwjrf() {
      this.haszwjrf = !this.haszwjrf;
      if (this.haszwjrf) {
        let obj = this.zwjrf;
        if (obj.itemId) {
          obj.id = obj.itemId;
        }
        this.axios
          .post("AdminAPI/project/addProjectItem", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.getdata();
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      }
    },
    bjgtzwr() {
      this.hasgtzwr = !this.hasgtzwr;
      if (this.hasgtzwr) {
        let obj = this.gtzwr;
        if (obj.itemId) {
          obj.id = obj.itemId;
        }
        this.axios
          .post("AdminAPI/project/addProjectItem", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.getdata();
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      }
    },
    bjcezfcnr() {
      this.hascezfcnr = !this.hascezfcnr;
      if (this.hascezfcnr) {
        let obj = this.cezfcnr;
        if (obj.itemId) {
          obj.id = obj.itemId;
        }
        this.axios
          .post("AdminAPI/project/addProjectItem", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.getdata();
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      }
    },
    bjdbf() {
      this.hasdbf = !this.hasdbf;
      let obj = this.dbf;
      obj.projectId = sessionStorage.getItem("swdypId");
      if (this.hasdbf) {
        this.axios
          .post("AdminAPI/project/updateGuarantee", this.dbf)
          .then(({ data }) => {
            if (data.code == 200) {
              this.getdata();
              this.getgys();
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      }
    },
    bjlssws() {
      this.haslssws = !this.haslssws;
      if (this.haslssws) {
        let obj = this.lssws;
        if (obj.itemId) {
          obj.id = obj.itemId;
        }
        this.axios
          .post("AdminAPI/project/addProjectItem", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.getdata();
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      }
    },
    bjhx() {
      this.hashxqy = !this.hashxqy;
      if (this.hashxqy) {
        let obj = this.hxqy;
        if (obj.itemId) {
          obj.id = obj.itemId;
        }
        this.axios
          .post("AdminAPI/project/addProjectItem", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.getdata();
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      }
    },
    delcom(item) {
      item.projectId = sessionStorage.getItem("swdypId");
      (item.isDelete = "1"),
        (item.id = item.itemId),
        this.$confirm("确定要删除吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            this.axios
              .post("AdminAPI/project/updateProjectItem", item)
              .then(({ data }) => {
                if (data.code == 200) {
                  this.$message({ message: "删除成功", type: "success" });
                  this.getdata();
                }
              });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除"
            });
          });
    },
    gsxx(parm) {
      this.currentCom = "parm";
    },
    blClick() {
      this.blbj = !this.blbj;
      if (this.blbj && this.hasbaoli == false) {
        //新增
        let obj = this.baoliData;
        this.axios
          .post("AdminAPI/project/addFactorInfo", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      } else if (this.blbj && this.hasbaoli) {
        //修改
        let obj = this.baoliData;
        obj.projectId = sessionStorage.getItem("swdypId");
        obj.id = obj.factorId;
        this.axios
          .post("AdminAPI/project/updateFactorInfo", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      }
    },
    cjClick() {
      this.cjbj = !this.cjbj;
      if (this.cjbj && this.hasChujia == false) {
        let obj = this.chujiaData;
        this.axios
          .post("AdminAPI/project/addSavingFrame", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      } else if (this.cjbj && this.hasChujia) {
        let obj = this.chujiaData;
        obj.id = obj.frameId;
        this.axios
          .post("AdminAPI/project/updateSavingFrame", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.$message({ message: "提交成功", type: "success" });
            }
          });
      }
    },
    xmClick() {
      this.xmbj = !this.xmbj;
      if (this.xmbj) {
        let obj = {
          principal: this.data.principal,
          teamMember: this.data.teamMember,
          id: this.pId
        };
        this.axios
          .post("AdminAPI/project/updateMemberById", obj)
          .then(({ data }) => {
            if (data.code == 200) {
              this.$message({ message: "提交成功", type: "success" });
              this.getdata();
            }
          });
      }
    },
    getdata() {
      this.axios
        .get("AdminAPI/project/showProjectInfo", {
          params: { id: sessionStorage.getItem("swdypId") }
        })
        .then(({ data }) => {
          this.data = data.data;
          if (data.data.SavingFrameWorkInfoList.length != 0) {
            this.chujiaData = data.data.SavingFrameWorkInfoList[0];
            this.hasChujia = true;
          }
          if (data.data.FactoringInfoList.length != 0) {
            this.baoliData = data.data.FactoringInfoList[0];
            this.hasbaoli = true;
          }
          if (data.data.核心企业) {
            this.hxqy = data.data.核心企业;
          }
          if (data.data.律师事务所) {
            this.lssws = data.data.律师事务所;
          }
          if (data.data.担保方) {
            this.dbf = data.data.担保方;
          }
          if (data.data.差额支付承诺人) {
            this.cezfcnr = data.data.差额支付承诺人;
          }
          if (data.data.共同债务人) {
            this.gtzwr = data.data.共同债务人;
          }
          if (data.data.债务加入方) {
            this.zwjrf = data.data.债务加入方;
          }
        });
    },
    // 新增提交储架信息
    subNewchujia() {
      let newchujia = this.newchujia;
      for (let k in newchujia) {
        if (!newchujia[k]) {
          this.$message({ message: "请填写完整", type: "warning" });
          return false;
        }
      }
      this.axios
        .post("AdminAPI/project/addSavingFrame", newchujia)
        .then(({ data }) => {
          if (data.code == 200) {
            this.getdata();
            this.$message({ message: "提交成功", type: "success" });
            this.dialogchujia = false;
          }
        });
    },
    handleClose(done) {
      this.getdata();
      done();
    },
    // 编辑储架信息提交
    submitbjChujia(id) {
      let obj = this.SavingFrameWorkInfoList[0];
      for (let k in obj) {
        if (!obj[k]) {
          this.$message({ message: "请填写完整", type: "warning" });
          return false;
        }
      }
      obj.id = id;
      obj.projectId = sessionStorage.getItem("swdypId");
      this.axios
        .post("AdminAPI/project/updateSavingFrame", obj)
        .then(({ data }) => {
          if (data.code == 200) {
            this.$message({ message: "修改成功", type: "success" });
            this.dialogBJchujia = false;
            this.getdata();
          }
        });
    },
    newdialogbaoli() {
      let newbaoli = this.newbaoli;
      for (let k in newbaoli) {
        if (!newbaoli[k]) {
          this.$message({ message: "请填写完整", type: "warning" });
          return false;
        }
      }
      this.axios
        .post("AdminAPI/project/addFactorInfo", newbaoli)
        .then(({ data }) => {
          if (data.code == 200) {
            this.getdata();
            this.$message({ message: "提交成功", type: "success" });
            this.dialogbaoli = false;
          }
        });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    chooseCompany() {
      this.$bus.$emit("chooseCompany", {
        callback: banks => {
          let banksName = [];
          let banksId = [];
          banks.forEach((item, index) => {
            banksName.push(item.bName);
            banksId.push(item.bId);
          });
          this.banksArr = banksName;
          this.banks = banksName.join(",");
          this.banksId = banksId;
        }
      });
    }
  }
};
</script>

<style lang="scss">
#projectMessage {
  .messageSwdy {
    margin-top: 0 !important;
    position: relative;
    .bianji,
    .back {
      position: absolute;
      right: 110px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 18px;
      font-weight: 400;
      color: rgba(230, 69, 69, 1);
      cursor: pointer;
    }
    .back {
      right: 160px;
      color: #409eff;
    }
  }
  .progress {
    margin-top: 10px;
    height: 260px;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0px 0px 2px 0px rgba(122, 121, 121, 0.5);
    border-radius: 6px;
    .stepBox {
      width: 640px;
      margin: 0 auto;
      padding-top: 36px;
    }
    .nav {
      margin-top: 90px;
      padding: 0 14%;
      display: flex;
      justify-content: space-between;
      > span {
        width: 109px;
        height: 39px;
        background: rgba(185, 185, 185, 1);
        box-shadow: 0px 0px 4px 0px rgba(100, 100, 100, 0.5);
        border-radius: 10px;
        color: white;
        font-size: 18px;
        text-align: center;
        line-height: 39px;
        &.active {
          background: rgba(30, 124, 240, 1);
          box-shadow: 0px 0px 4px 0px rgba(100, 100, 100, 0.5);
        }
      }
    }
  }
  .baseBox {
    // height: 530px;
    padding: 50px 0;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
    .baseLeft {
      width: 372px;
      font-size: 18px;
      font-weight: 400;
      color: rgba(51, 51, 51, 1);
      p {
        line-height: 30px;
        display: flex;
        span {
          height: 100%;
          &:first-child {
            font-size: 18px;
            min-width: 90px;
            text-align: right;
          }
          &:last-child {
            font-size: 16px;
          }
        }
      }
    }
    .baseRight {
      text-align: center;
      width: 581px;
      height: 395px;
    }
  }
  .tableBox {
    background: white;
    padding: 48px 76px;
    .leave {
      width: 100%;
      border-collapse: collapse;
      color: #333333;
      tr {
        td {
          min-width: 100px;
          text-align: center;
          border: 1px solid #dfdcdf;
          padding: 16px 8px;
          &:nth-child(odd) {
            background: #fffaf3;
          }
        }
      }
    }
    .vertatic {
      width: 100%;
      border-collapse: collapse;
      color: #333333;
      tr {
        &:first-child {
          td {
            background: #fffaf3;
          }
        }
        td {
          text-align: center;
          border: 1px solid #dfdcdf;
          padding: 16px 8px;
          .red {
            color: #e64545;
            cursor: pointer;
          }
        }
      }
    }
  }
  .swelrow {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    .left {
      text-align: right;
    }
    .el-input {
      width: 100%;
    }
  }
  .swdyTops {
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #b9b9b9;
    padding-bottom: 26px;
    .el-input {
      width: 160px;
    }
    .sousuo {
      margin: 0 40px;
    }
  }
  .diatable {
    margin-top: 10px;
    background: white;
    padding-top: 16px;
    .has-gutter tr th {
      background: #fefaf1;
    }
    .block {
      text-align: right;
      margin-right: 55px;
      height: 50px;
      margin-top: 20px;
    }
  }
  .eldtitle {
    font-size: 16px;
    line-height: 40px;
  }
  .el-tag {
    margin-right: 20px;
  }
}
</style>
